/**  
 * Copyright (c) 2010 University of Pennsylvania.
 *     All rights reserved.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an "AS
 *  IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 *  express or implied.  See the License for the specific language
 *  governing permissions and limitations under the License.
 *
 */
 
//#define TINYOS2               // UPDATE THIS IN BOTH *M.nc and *.nc!
#define SENSORBOARD_ITS400      // UPDATE THIS IN BOTH *M.nc and *.nc!
//#define SENSORBOARD_MTS400CB  // UPDATE THIS IN BOTH *M.nc and *.nc!
#define USE_BLUSH               // UPDATE THIS IN BOTH *M.nc and *.nc!

configuration streamint {
}

implementation {
  components streamintM, LedsC;
#ifndef TOSSIM  
  components ResetC;
#endif  
  
#ifdef TINYOS2  
  components MainC, ActiveMessageC, SerialActiveMessageC;
  components new AMSenderC(7);
  components new AMReceiverC(7);
  components new AMSnooperC(7);
  components new TimerMilliC();

  streamintM.Boot -> MainC.Boot;
  streamintM.UARTControl -> SerialActiveMessageC;
  streamintM.ReceiveUART -> SerialActiveMessageC.Receive[9];
  streamintM.SendUART -> SerialActiveMessageC.AMSend[9];
  streamintM.ReceiveT -> AMReceiverC;
  streamintM.ReceiveS -> AMSnooperC;
  streamintM.AMSend -> AMSenderC;
  streamintM.RadioControl -> ActiveMessageC;
  streamintM.Timer1 -> TimerMilliC;
  streamintM.Timer2 -> TimerMilliC;
  streamintM.Packet -> AMSenderC;
  streamintM.AMPacket -> AMSenderC;
  streamintM.PacketAck -> AMSenderC;
#else
  components Main, TimerC, RadioCRCPacket as Comm, CC2420ControlM,
#ifdef USE_BLUSH
  BluSHC;
#else  
  FramerM, UART;
#endif  
  
#ifdef SENSORBOARD_ITS400
  components PXA27XI2CM, PMICC, SHTM, PXA27XGPIOIntC; 
  
  streamintM.I2CControl -> PXA27XI2CM;
  streamintM.I2C -> PXA27XI2CM;
  streamintM.PMIC -> PMICC;
  
  streamintM.SHTMControl -> SHTM.StdControl;
  SHTM.Timer -> TimerC.Timer[unique("Timer")];
  streamintM.TempSensor -> SHTM.TempSensor;
  streamintM.HumSensor -> SHTM.HumSensor;
  SHTM.ADCCompleteInt -> PXA27XGPIOIntC.PXA27XGPIOInt[100]; // SDA is on GPIO 100
#endif

#ifdef SENSORBOARD_MTS400CB
  components SensirionHumidity, TaosPhoto;
  
  streamintM.TaosControl -> TaosPhoto;
  streamintM.TaosCh0 -> TaosPhoto.ADC[0];
  streamintM.TaosCh1 -> TaosPhoto.ADC[1];
  streamintM.TempHumControl -> SensirionHumidity;
  streamintM.Humidity -> SensirionHumidity.Humidity;
  streamintM.Temperature -> SensirionHumidity.Temperature;
  streamintM.HumidityError -> SensirionHumidity.HumidityError;
  streamintM.TemperatureError -> SensirionHumidity.TemperatureError;
#endif

  Main.StdControl -> TimerC.StdControl;
  Main.StdControl -> streamintM;

  streamintM.Timer1 -> TimerC.Timer[unique("Timer")];
  streamintM.Timer2 -> TimerC.Timer[unique("Timer")];
  streamintM.CommControl -> Comm;
  streamintM.BareSendMsg -> Comm;
  streamintM.ReceiveMsg -> Comm;
  
#ifdef USE_BLUSH
  streamintM.Timer3 -> TimerC.Timer[unique("Timer")];
  BluSHC.BluSH_AppI[unique("BluSH")] -> streamintM.BlushCommand;
  BluSHC.BluSH_AppI[unique("BluSH")] -> streamintM.BlushAttr;
  BluSHC.BluSH_AppI[unique("BluSH")] -> streamintM.BlushDebug;
#else  
  streamintM.UARTControl -> FramerM;
  streamintM.UARTSend -> FramerM;
  streamintM.UARTReceive -> FramerM;
  streamintM.UARTTokenReceive -> FramerM; 
  FramerM.ByteControl -> UART;
  FramerM.ByteComm -> UART;
#endif  

  streamintM.CC2420Control -> CC2420ControlM;
#endif  

  streamintM.Leds -> LedsC;
#ifndef TOSSIM  
  streamintM.Reset -> ResetC;
#endif  
}
